--- Makefile-	2014-04-17 19:12:52.415410443 +0300
+++ Makefile	2014-04-17 19:13:19.979613470 +0300
@@ -1,7 +1,8 @@
 ### Edit this:
-INSTALL_PATH=/usr/local/rejik3
-SQUID_USER=squid
-SQUID_GROUP=squid
+INSTALL_PATH=/var/lib/rejik
+DSTDIR_PATH=${DSTDIR}${INSTALL_PATH}
+SQUID_USER=nobody
+SQUID_GROUP=nogroup
 
 CC=gcc -Wall
 INCLUDE=-I/usr/include -I/usr/local/include -I/usr/include/pcre
@@ -40,36 +41,38 @@
 
 install:
 # Make dirs
-	mkdir -p ${INSTALL_PATH}/tools
+	mkdir -p ${DSTDIR_PATH}/tools
+	mkdir -p ${DSTDIR}/etc/squid
+	mkdir -p ${DSTDIR}/var/log/squid/rejik
 
 # Install redirector
-	cp make-cache ${INSTALL_PATH}
-	cp redirector ${INSTALL_PATH}
-	cp redirector.conf.dist ${INSTALL_PATH}
+	cp make-cache ${DSTDIR_PATH}
+	cp redirector ${DSTDIR_PATH}
+	cp redirector.conf.dist ${DSTDIR}/etc/squid
 
 # Install tools	
-	echo "#!/bin/sh" > ${INSTALL_PATH}/tools/check-redirector
-	echo 'su ${SQUID_USER} -c "echo \"http://sex.ru 127.0.0.1/- - GET\" | ${INSTALL_PATH}/redirector ${INSTALL_PATH}/redirector.conf;"' >> ${INSTALL_PATH}/tools/check-redirector
-	chmod 755  ${INSTALL_PATH}/tools/check-redirector
+	echo "#!/bin/sh" > ${DSTDIR_PATH}/tools/check-redirector
+	echo 'su ${SQUID_USER} -c "echo \"http://sex.ru 127.0.0.1/- - GET\" | ${INSTALL_PATH}/redirector ${INSTALL_PATH}/redirector.conf;"' >> ${DSTDIR_PATH}/tools/check-redirector
+	chmod 755  ${DSTDIR_PATH}/tools/check-redirector
 
-	echo "#!/bin/sh" > ${INSTALL_PATH}/tools/set-permissions
-	echo 'chown -R ${SQUID_USER}:${SQUID_GROUP} ${INSTALL_PATH}' >> ${INSTALL_PATH}/tools/set-permissions
-	chmod 755  ${INSTALL_PATH}/tools/set-permissions
+	echo "#!/bin/sh" > ${DSTDIR_PATH}/tools/set-permissions
+	echo 'chown -R ${SQUID_USER}:${SQUID_GROUP} ${INSTALL_PATH}' >> ${DSTDIR_PATH}/tools/set-permissions
+	chmod 755  ${DSTDIR_PATH}/tools/set-permissions
 
 
-	cp tools/kill-cache ${INSTALL_PATH}/tools
-	chmod 755  ${INSTALL_PATH}/tools/kill-cache
+	cp tools/kill-cache ${DSTDIR_PATH}/tools
+	chmod 755  ${DSTDIR_PATH}/tools/kill-cache
 
-	cp tools/benchmark ${INSTALL_PATH}/tools	
-	chmod 755  ${INSTALL_PATH}/tools/benchmark
+	cp tools/benchmark ${DSTDIR_PATH}/tools
+	chmod 755  ${DSTDIR_PATH}/tools/benchmark
 
-	cp tools/IN.gz ${INSTALL_PATH}/tools
-	chmod 644 ${INSTALL_PATH}/tools/IN.gz
+	cp tools/IN.gz ${DSTDIR_PATH}/tools
+	chmod 644 ${DSTDIR_PATH}/tools/IN.gz
 
 # Set permissions
-	chown -R ${SQUID_USER}:${SQUID_GROUP} ${INSTALL_PATH}
-	chmod 770 ${INSTALL_PATH}
-	chmod 644 ${INSTALL_PATH}/redirector.conf.dist 
-	chmod 755 ${INSTALL_PATH}/redirector 
-	chmod 755 ${INSTALL_PATH}/make-cache
+	chown -R ${SQUID_USER}:${SQUID_GROUP} ${DSTDIR_PATH} ${DSTDIR} ${DSTDIR}/var/log/squid/rejik
+	chmod 770 ${DSTDIR_PATH}
+	chmod 644 ${DSTDIR}/etc/squid/redirector.conf.dist
+	chmod 755 ${DSTDIR_PATH}/redirector 
+	chmod 755 ${DSTDIR_PATH}/make-cache
 
